import { axios } from '@/utils/request'

const api = {
  getGoods: '/md-goods/food',
  addGoods: '/md-goods/food-save',
  goodsCats: '/md-goods/food-cat',
  editGoods: '/md-goods/edit',
  setAttribute: '/md-goods/update-attribute',
  getOrderDesk: '/md-goods/table-list',
  getOrderAddDesk: '/md-goods/table-add',
  deleteOrderDesk: '/md-goods/table-del',
  getOrderDeskQrcode: 'md-goods/down-qr',
  orderDeskEdit: '/md-goods/table-edit',
  getSetting: '/md-goods/food-setting-info',
  saveSetting: '/md-goods/food-setting',
  getQrcode: '/md-goods/food-qr',
  slideList: '/md-goods/banner-list',
  slideEdit: '/md-goods/banner-edit',
  slideDelete: '/md-goods/banner-delete',
  catList: '/md-goods/cat-list',
  catChangeStatus: '/md-goods/cat-status',
  catDel: '/md-goods/cat-del',
  catEdit: '/md-goods/cat-edit',
  getFoodSetting: '/store/food-setting-info',
  saveFoodSetting: '/store/food-setting',
  DownQrcodeRules: '/md-goods/down-qrcode-rules',
  AliBindQrcode: '/md-goods/ali-bind-qrcode',
  IsBind: '/md-goods/is-bind',
  foodExtGoodsSave: '/md-goods/food-ext-goods-save',
  foodExtGoodsList: '/md-goods/food-ext-goods-list',
  foodExtGoodsDefault: '/md-goods/food-ext-goods-default',
  foodExtGoodsDel: '/md-goods/food-ext-goods-del',
  foodSave: '/md-goods/food-save',
}

export default api

export function getCatList(parameter) {
  return axios({
    url: api.catList,
    method: 'get',
    params: parameter,
  })
}
export function catChangeStatus(parameter) {
  return axios({
    url: api.catChangeStatus,
    method: 'post',
    data: parameter,
  })
}

export function catDelItem(parameter) {
  return axios({
    url: api.catDel,
    method: 'post',
    data: parameter,
  })
}

export function catEditItem(parameter) {
  return axios({
    url: api.catEdit,
    method: 'post',
    data: parameter,
  })
}

export function getGoods(parameter) {
  return axios({
    url: api.getGoods,
    method: 'get',
    params: parameter,
  })
}

export function getGoodsCats(parameter) {
  return axios({
    url: api.goodsCats,
    method: 'get',
    params: parameter,
  })
}

export function addGoods(parameter, isStore) {
  let url = api.addGoods
  return axios({
    url: url,
    method: 'post',
    data: parameter,
    storeUseMd: isStore,
  })
}

export function editGoods(parameter) {
  return axios({
    url: api.editGoods,
    method: 'get',
    params: parameter,
  })
}

export function setAttribute(parameter) {
  return axios({
    url: api.setAttribute,
    method: 'post',
    data: parameter,
  })
}

export function getOrderDesk(parameter) {
  return axios({
    url: api.getOrderDesk,
    method: 'get',
    params: parameter,
  })
}

export function getOrderAddDesk(parameter, isStore) {
  return axios({
    url: api.getOrderAddDesk,
    method: 'post',
    data: parameter,
    storeUseMd: isStore,
  })
}

export function deleteOrderDesk(parameter) {
  return axios({
    url: api.deleteOrderDesk,
    method: 'post',
    data: parameter,
  })
}

export function getOrderDeskQrcode(parameter) {
  return axios({
    url: api.getOrderDeskQrcode,
    method: 'post',
    data: parameter,
  })
}

export function orderDeskEdit(parameter) {
  return axios({
    url: api.orderDeskEdit,
    method: 'post',
    data: parameter,
  })
}

export function getSetting(parameter, isStore) {
  return axios({
    url: api.getSetting,
    method: 'get',
    params: parameter,
    storeUseMd: isStore,
  })
}

export function getFoodSetting(parameter) {
  return axios({
    url: api.getFoodSetting,
    method: 'get',
    params: parameter,
  })
}

export function saveSetting(parameter, isStore) {
  return axios({
    url: api.saveSetting,
    method: 'post',
    data: parameter,
    storeUseMd: isStore,
  })
}

export function saveFoodSetting(parameter) {
  return axios({
    url: api.saveFoodSetting,
    method: 'post',
    data: parameter,
  })
}

export function getQrcode(parameter, isStore) {
  return axios({
    url: api.getQrcode,
    method: 'get',
    params: parameter,
    storeUseMd: isStore,
  })
}

export function DownQrcodeRules(parameter) {
  return axios({
    url: api.DownQrcodeRules,
    method: 'get',
    params: parameter,
  })
}

export function AliBindQrcode(parameter) {
  return axios({
    url: api.AliBindQrcode,
    method: 'get',
    params: parameter,
  })
}

export function IsBind(parameter) {
  return axios({
    url: api.IsBind,
    method: 'get',
    params: parameter,
  })
}

export function slideList(parameter) {
  return axios({
    url: api.slideList,
    method: 'get',
    params: parameter,
  })
}

export function slideDelete(parameter) {
  return axios({
    url: api.slideDelete,
    method: 'post',
    data: parameter,
  })
}

export function slideEdit(parameter, isStore) {
  return axios({
    url: api.slideEdit,
    method: 'post',
    data: parameter,
    storeUseMd: isStore,
  })
}

export function foodExtGoodsSave(data) {
  return axios({
    url: api.foodExtGoodsSave,
    method: 'post',
    data,
  })
}

export function foodSave(data) {
  return axios({
    url: api.foodSave,
    method: 'post',
    data,
  })
}

export function foodExtGoodsList(params) {
  return axios({
    url: api.foodExtGoodsList,
    method: 'get',
    params,
  })
}

export function foodExtGoodsDefault(params) {
  return axios({
    url: api.foodExtGoodsDefault,
    method: 'get',
    params,
  })
}

export function foodExtGoodsDel(params) {
  return axios({
    url: api.foodExtGoodsDel,
    method: 'get',
    params,
  })
}
